package com.wwc.business.controller;

import com.wwc.business.controller.dto.train_station.TrainStationDeleteDTO;
import com.wwc.business.controller.dto.train_station.TrainStationInsertDTO;
import com.wwc.business.controller.dto.train_station.TrainStationSelectListDTO;
import com.wwc.business.controller.dto.train_station.TrainStationUpdateDTO;
import com.wwc.business.controller.vo.TrainStationSelectListVO;
import com.wwc.business.service.ITrainStationService;
import com.wwc.common.response.CommonResponse;
import com.wwc.common.response.PageResponse;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.web.bind.annotation.*;

/**
 * 火车车站 Controller
 */
@RestController
@RequestMapping("/admin/train-station")
public class TrainStationController{
	@Resource
	private ITrainStationService trainStationService;

	/**
	 * 新增火车车站
	 */
	@PostMapping("/insert")
	public CommonResponse<?> insert(@Valid @RequestBody TrainStationInsertDTO trainStationInsertDTO){
		trainStationService.insert(trainStationInsertDTO);
		return new CommonResponse<>();
	}

	/**
	 * 更新火车车站
	 */
	@PostMapping("/update")
	public CommonResponse<?> update(@Valid @RequestBody TrainStationUpdateDTO trainStationUpdateDTO){
		trainStationService.update(trainStationUpdateDTO);
		return new CommonResponse<>();
	}

	/**
	 * 删除火车车站
	 */
	@PostMapping("/delete")
	public CommonResponse<?> delete(@Valid @RequestBody TrainStationDeleteDTO trainStationDeleteDTO){
		trainStationService.delete(trainStationDeleteDTO);
		return new CommonResponse<>();
	}

	/**
	 * 查询火车车站分页列表
	 */
	@GetMapping("/select-list-page")
	public CommonResponse<PageResponse<TrainStationSelectListVO>> selectListPage(@Valid TrainStationSelectListDTO trainStationSelectListDTO){
		PageResponse<TrainStationSelectListVO> pageResponse = trainStationService.selectListPage(trainStationSelectListDTO);
		return new CommonResponse<>(pageResponse);
	}
}
